from resource_management import check_process_status
from resource_management.core.resources.system import Directory, Execute, File
from ambari_commons.os_family_impl import OsFamilyImpl, OsFamilyFuncImpl
from utils import service, PidFiles



@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
def dfsrouter(action=None):
  if action == "configure":
    import params
    pass
  elif action == "start" or action == "stop":
    import params
    service(
      action=action, name="dfsrouter",
      user=params.hdfs_user,
      create_pid_dir=True,
      create_log_dir=True
    )
  elif action == "status":
    import status_params
    check_process_status(status_params.dfsrouter_pid_file)
